import Data from '@/chaos/functions/common/Data';
import Show from '@/chaos/functions/common/Show';

export const updateOrder = {
    data() {
        return {
            showUpdateForm: false,
            orderTime: '',
        };
    },
    methods: {
        async showUpdate(orderMu, orderTime) {
            this.orderMu = orderMu;
            this.orderTime = orderTime;
            this.showUpdateForm = true;
        },
        async doUpdate() {
            if (!this.orderTime) {
                Show.warning('请输入预约时间');
                return;
            }
            await Data.update(this.domain, this.orderMu, {
                orderTime: this.orderTime,
                status: 1,
            });
            this.showUpdateForm = false;
            this.search();
        },
        doCancel(orderMu) {
            Data.submit(
                this.domain + '/update',
                {
                    mu: orderMu,
                    data: { status: 4 },
                },
                () => this.search()
            );
        },
    },
};
